import Mock from 'mockjs';
import setupMock, {
  successResponseWrap,
  failResponseWrap,
} from '@/utils/setup-mock';
const { Random } = Mock;

const data = Mock.mock({
  'data|20': [
    {
      'id': /[1-9]/,
      'businessName': Random.cword(5, 14),
      'count|1': /[1-9]/,
      'price|3': /[0-9]/,
      'createDate': new Date()
    },
  ],
  'recordsTotal': 20,
});
const buyData = Mock.mock({
  'data|20': [
    {
      'buyType': Random.cword(5, 14),
      'price|3': /[0-9]/,
      'createDate': new Date()
    },
  ],
  'recordsTotal': 20,
});
setupMock({
  setup() {
    // 用户信息
    Mock.mock(new RegExp('/api/column/list'), () => {
      return successResponseWrap(data);
    });
    Mock.mock(new RegExp('/api/video/list'), () => {
      return successResponseWrap(buyData);
    });
  }
});
